class CurModel {
    static get_client() {
        return CurModel.getItem("client");
    }

    static set_client(db) {
        sessionStorage.setItem("client", db);
    }

    static get_db(tab) {
        return CurModel.getItem(`mestab__${tab}`);
    }

    static set_db(tab, db) {
        sessionStorage.setItem(`mestab__${tab}`, db);
    }

    static get_cur_wsn() {
        return CurModel.getItem("cur_wsn", "");
    }

    static set_cur_wsn(v) {
        sessionStorage.setItem('cur_wsn', v);
    }

    static getLine() {
        const line = CurModel.getItem("line", "line-one");
        return line;
    }

    static setLine(cur) {
        sessionStorage.setItem('line', cur);
    }

    static setLineDes(cur) {
        sessionStorage.setItem('linedes', cur);
    }

    static getLineDes() {
        const line = CurModel.getItem("linedes", "");
        return line;
    }

    static getSelect(def) {
        return CurModel.getItem("select", def);
    }

    static setSelect(cur) {
        sessionStorage.setItem('select', cur);
    }

    static setItem(item, def) {
        sessionStorage.setItem(item, def);
    }

    static getItem(item, def) {
        let cur = sessionStorage.getItem(item);
        if (!cur) {
            return def;
        }

        if (cur.length <= 0) {
            return def;
        }

        return cur;
    }
}

const cline = () => CurModel.getLine();

export {cline, CurModel};
